package com.itheima.model.vo;

import com.itheima.model.domain.UserInfo;
import com.itheima.model.mongo.Peachblossom;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PeachblossomVo implements Serializable {


    private Long id;
    private String avatar; //头像
    private String nickname; //昵称

    private String soundUrl; //视频URL
    private String gender; //视频URL


    private Integer age; 
    private Integer remainingTimes = 8; //评论数量

    public static PeachblossomVo init(UserInfo userInfo, Peachblossom item) {
        PeachblossomVo vo = new PeachblossomVo();
        //copy用户属性
        BeanUtils.copyProperties(userInfo, vo);
        //copy视频属性
        BeanUtils.copyProperties(item, vo);
//        vo.setId(item.getId());
        vo.setRemainingTimes(8);
        return vo;
    }
}